﻿package com.amcharts.chartClasses
{
    import com.amcharts.axes.*;
    import com.amcharts.events.*;
    import com.amcharts.geom.*;
    import com.amcharts.utils.*;
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    import mx.collections.*;
    import mx.core.*;
    import mx.formatters.*;
    import mx.styles.*;
    import mx.utils.*;

    public class ChartCursor extends UIComponent
    {
        private var _grabAndDrag:Class;
        protected var _graphs:Array;
        protected var _selection:Rect;
        protected var _type:String = "cursor";
        protected var _previousIndex:Number;
        protected var _firstTime:Number;
        protected var _end:Number;
        protected var _draw:Boolean;
        protected var _interval:Number;
        protected var _bulletsContainer:UIComponent;
        protected var _panClickEnd:Number;
        protected var _selectionPosX:Number;
        protected var _selectionPosY:Number;
        protected var _drawStartY:Number;
        protected var _cursorsChanged:Boolean;
        protected var _previousMousePosition:Number;
        protected var _drawStartX:Number;
        protected var _selectWithoutZooming:Boolean;
        protected var _previousMouseX:Number;
        protected var _previousMouseY:Number;
        protected var _oneBalloonOnly:Boolean;
        protected var _panClickStart:Number;
        protected var _categoryBalloonPosition:String;
        protected var _valueBalloonsContainer:UIComponent;
        protected var _rolledOver:Boolean;
        protected var _cursor:Sprite;
        protected var _bulletsEnabled:Boolean = false;
        protected var _rotate:Boolean;
        private var _drawPointer:Class;
        protected var _panClickEndTime:Number;
        protected var _crosshair:Boolean;
        protected var _initialMouseX:Number;
        protected var _initialMouseY:Number;
        protected var _valueBalloons:Array;
        protected var _cursorPosition:String = "middle";
        protected var _startTime:Number;
        protected var _zoomed:Boolean;
        protected var _line:Sprite;
        protected var _axisThickness:Number;
        protected var _hitRect:PlotArea;
        protected var _stepWidth:Number;
        protected var _chart:AmRectangularChart;
        protected var _showValueAxisValue:Boolean;
        protected var _drawing:Boolean;
        protected var _skipZoomDispatch:Boolean;
        protected var _endTime:Number;
        protected var _zoomable:Boolean = true;
        protected var _categoryBalloon:AmBalloon;
        protected var _inside:Boolean;
        protected var _panClickStartTime:Number;
        private var _grab:Class;
        protected var _dx:Number = 0;
        protected var _dy:Number = 0;
        protected var _start:Number;
        protected var _showValueOfAxis:ValueAxis;
        protected var _drawingLine:Line;
        protected var _valueAxisBalloon:AmBalloon;
        protected var _valueLine:Line;
        protected var _panning:Boolean;
        protected var _dataProvider:ArrayCollection;
        protected var _categoryAxis:CategoryAxis;
        protected var _initialMouse:Number;
        protected var _animate:Boolean = true;
        protected var _panClickPos:Number;
        protected var _valueBalloonsEnabled:Boolean = true;
        protected var _bulletSize:Number = 8;
        protected var _fromIndex:uint;
        protected var _mask:Rect;
        protected var _categoryBalloonEnabled:Boolean = true;
        protected var _index:Number;
        protected var _pan:Boolean;
        protected var _lastTime:Number;
        protected var _cursorColor:uint;
        protected var _zooming:Boolean;
        protected var _categoryBalloonDateFormat:String = "MMM DD, YYYY";
        static const VERSION:String = "1.8.3.1";
        private static var stylesInited:Boolean = initStyles();

        public function ChartCursor() : void
        {
            _grab = ChartCursor__grab;
            _grabAndDrag = ChartCursor__grabAndDrag;
            _drawPointer = ChartCursor__drawPointer;
            _dataProvider = new ArrayCollection();
            this.includeInLayout = false;
            addEventListener(Event.ADDED_TO_STAGE, onAdded);
            addEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
            return;
        }// end function

        protected function updateValueAxisBalloon() : void
        {
            var _loc_2:Number = NaN;
            var _loc_3:Number = NaN;
            var _loc_4:Number = NaN;
            var _loc_1:* = balloonValueAxis();
            if (_loc_1)
            {
                if (_rotate)
                {
                    _loc_2 = _loc_1.coordinateToValue(this.mouseX);
                    _valueAxisBalloon.setPosition(this.mouseX, _loc_1.visibleAxisY);
                }
                else
                {
                    _loc_3 = _loc_1.mouseY;
                    if (_loc_3 > 0)
                    {
                    }
                    if (_loc_3 < _loc_1.visibleAxisHeight)
                    {
                        _loc_2 = _loc_1.coordinateToValue(this.mouseY);
                        _loc_4 = _loc_1.visibleAxisX;
                        if (_loc_1.position == "right")
                        {
                            _loc_4 = _loc_4 + (_loc_1.visibleAxisWidth + 1);
                        }
                        _valueAxisBalloon.setPosition(_loc_4, this.mouseY + _valueAxisBalloon.height / 2);
                    }
                }
                if (_loc_2)
                {
                    _valueAxisBalloon.show(_loc_1.formatValue(_loc_2));
                }
                else
                {
                    _valueAxisBalloon.hide();
                }
            }
            return;
        }// end function

        protected function removeDrawingLine() : void
        {
            if (_drawingLine)
            {
                if (_drawingLine.parent == this)
                {
                    this.removeChild(_drawingLine);
                }
            }
            return;
        }// end function

        public function get crosshair() : Boolean
        {
            return _crosshair;
        }// end function

        public function get oneBalloonOnly() : Boolean
        {
            return _oneBalloonOnly;
        }// end function

        public function get bulletSize() : Number
        {
            return _bulletSize;
        }// end function

        protected function updateValueLine() : void
        {
            if (_rotate)
            {
                _valueLine.x = this.mouseX;
            }
            else
            {
                _valueLine.y = this.mouseY;
            }
            return;
        }// end function

        public function set crosshair(param1:Boolean) : void
        {
            _crosshair = param1;
            return;
        }// end function

        public function get showValueAxisValue() : Boolean
        {
            return _showValueAxisValue;
        }// end function

        public function set bulletSize(param1:Number) : void
        {
            _bulletSize = param1;
            return;
        }// end function

        public function get bulletsEnabled() : Boolean
        {
            return _bulletsEnabled;
        }// end function

        public function clean() : void
        {
            destroyListeners();
            destroy();
            return;
        }// end function

        protected function onAdded(event:Event) : void
        {
            _interval = setInterval(detectMovement, 20);
            stage.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
            stage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
            stage.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
            stage.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
            return;
        }// end function

        public function set zooming(param1:Boolean) : void
        {
            if (param1)
            {
            }
            if (param1 != _zooming)
            {
                handleMouseDown();
            }
            if (!param1)
            {
            }
            if (param1 != _zooming)
            {
                handleMouseUp();
            }
            return;
        }// end function

        public function hideSelection() : void
        {
            _selection.visible = false;
            return;
        }// end function

        public function set oneBalloonOnly(param1:Boolean) : void
        {
            _oneBalloonOnly = param1;
            return;
        }// end function

        public function set showValueAxisValue(param1:Boolean) : void
        {
            _showValueAxisValue = param1;
            return;
        }// end function

        protected function detectMovement() : void
        {
            if (this.mouseX > 0)
            {
            }
            if (this.mouseX < this.width)
            {
            }
            if (this.mouseY > 0)
            {
            }
            if (this.mouseY < this.height)
            {
            }
            if (_chart.rolledOver)
            {
                if (_draw)
                {
                    if (!_rolledOver)
                    {
                        this.cursorManager.setCursor(_drawPointer);
                        _cursorsChanged = true;
                    }
                }
                else if (_pan)
                {
                    if (!_rolledOver)
                    {
                        this.cursorManager.setCursor(_grab);
                        _cursorsChanged = true;
                    }
                }
                _rolledOver = true;
                setPosition();
            }
            else if (_rolledOver)
            {
                handleMouseOut();
                removeCursors();
                _rolledOver = false;
            }
            return;
        }// end function

        protected function arrangeBalloons2() : void
        {
            var _loc_2:Number = NaN;
            var _loc_3:Number = NaN;
            var _loc_5:AmBalloon = null;
            var _loc_6:Number = NaN;
            _valueBalloons.reverse();
            var _loc_1:* = _valueBalloons.length;
            var _loc_4:Number = 0;
            while (_loc_4 < _loc_1)
            {
                
                _loc_5 = _valueBalloons[_loc_4].balloon;
                _loc_2 = _loc_5.bottomCoordinate;
                _loc_6 = _loc_5.bottomCoordinate - _loc_5.yPos;
                if (_loc_4 > 0)
                {
                    if (_loc_2 - _loc_6 < _loc_3 + 3)
                    {
                        _loc_5.setBounds(0, _loc_3 + 3, this.width, _loc_3 + _loc_6 + 3);
                        _loc_5.validateDisplayList();
                    }
                }
                _loc_3 = _loc_5.bottomCoordinate;
                _loc_4 = _loc_4 + 1;
            }
            return;
        }// end function

        public function set type(param1:String) : void
        {
            _type = param1;
            return;
        }// end function

        protected function createCrosshair() : void
        {
            var _loc_1:* = getStyle("cursorAlpha");
            var _loc_2:* = getStyle("selectionAlpha");
            _hitRect.setSize(this.width, this.height, _dx, _dy);
            _mask.width = this.width;
            _mask.height = this.height;
            _cursor.mask = _mask;
            _line = new Sprite();
            _cursor.addChild(_line);
            var _loc_3:* = new Line([0, 0], [(-this.height) * 1.1, this.height * 1.1], _cursorColor, _loc_1, 0);
            _line.addChild(_loc_3);
            var _loc_4:* = new Line([(-this.width) * 1.1, this.width * 1.1], [0, 0], _cursorColor, _loc_1, 0);
            _line.addChild(_loc_4);
            _selection = new Rect(1, 1, [_cursorColor], [_loc_2]);
            _cursor.addChild(_selection);
            _selection.visible = false;
            hideCursor();
            return;
        }// end function

        public function set draw(param1:Boolean) : void
        {
            this.enabled = !param1;
            hideCursor();
            removeCursors();
            _rolledOver = false;
            _draw = param1;
            return;
        }// end function

        public function get pan() : Boolean
        {
            return _pan;
        }// end function

        public function get cursorPosition() : String
        {
            return _cursorPosition;
        }// end function

        public function set bulletsEnabled(param1:Boolean) : void
        {
            _bulletsEnabled = param1;
            return;
        }// end function

        public function get categoryBalloonEnabled() : Boolean
        {
            return _categoryBalloonEnabled;
        }// end function

        protected function handleMouseOut() : void
        {
            var _loc_1:CursorEvent = null;
            if (enabled)
            {
                if (_zooming)
                {
                    setPosition();
                }
                else
                {
                    _index = undefined;
                    _loc_1 = new CursorEvent(CursorEvent.CHANGED);
                    _loc_1.index = undefined;
                    dispatchEvent(_loc_1);
                    hideCursor();
                }
            }
            return;
        }// end function

        protected function removeCursors() : void
        {
            if (_cursorsChanged)
            {
                this.cursorManager.removeAllCursors();
                _cursorsChanged = false;
            }
            return;
        }// end function

        protected function updateSelectionWidth(param1:Number) : void
        {
            if (_selectionPosX > param1)
            {
                _selection.x = param1;
                _selection.width = _selectionPosX - param1;
            }
            if (_selectionPosX < param1)
            {
                _selection.x = _selectionPosX;
                _selection.width = param1 - _selectionPosX;
            }
            if (_selectionPosX == param1)
            {
                _selection.x = param1;
                _selection.width = 0;
            }
            return;
        }// end function

        public function set rotate(param1:Boolean) : void
        {
            _rotate = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function get valueBalloonsEnabled() : Boolean
        {
            return _valueBalloonsEnabled;
        }// end function

        public function set selectWithoutZooming(param1:Boolean) : void
        {
            _selectWithoutZooming = param1;
            invalidateDisplayList();
            return;
        }// end function

        protected function handleMouseUp(event:MouseEvent = null) : void
        {
            var _loc_2:CursorEvent = null;
            var _loc_3:CursorEvent = null;
            var _loc_4:Number = NaN;
            var _loc_5:Number = NaN;
            var _loc_6:Number = NaN;
            if (_drawing)
            {
                _drawing = false;
                removeDrawingLine();
                if (Math.abs(_drawStartX - this.mouseX) <= 2)
                {
                }
                if (Math.abs(_drawStartY - this.mouseY) > 2)
                {
                    _loc_2 = new CursorEvent(CursorEvent.DRAW);
                    _loc_2.initialX = _drawStartX;
                    _loc_2.initialY = _drawStartY;
                    _loc_2.finalX = this.mouseX;
                    _loc_2.finalY = this.mouseY;
                    dispatchEvent(_loc_2);
                }
            }
            if (enabled)
            {
                Utils.removeChildren(_bulletsContainer);
                if (_pan)
                {
                    removeCursors();
                    _rolledOver = false;
                }
                else if (_zoomable)
                {
                    if (_zooming)
                    {
                        if (!_selectWithoutZooming)
                        {
                            _selection.visible = false;
                        }
                        if (_type == "cursor")
                        {
                            if (_rotate)
                            {
                                _loc_4 = this.mouseY;
                            }
                            else
                            {
                                _loc_4 = this.mouseX;
                            }
                            if (Math.abs(_loc_4 - _initialMouse) < 2)
                            {
                            }
                            if (_fromIndex == _index)
                            {
                            }
                            else if (_index != _fromIndex)
                            {
                                if (!_selectWithoutZooming)
                                {
                                    _loc_3 = new CursorEvent(CursorEvent.ZOOMED);
                                }
                                else
                                {
                                    _loc_3 = new CursorEvent(CursorEvent.SELECTED);
                                }
                                if (_index < _fromIndex)
                                {
                                    _loc_3.end = _fromIndex;
                                    _loc_3.start = _index;
                                }
                                else
                                {
                                    _loc_3.end = _index;
                                    _loc_3.start = _fromIndex;
                                }
                                if (_categoryAxis.parseDates)
                                {
                                }
                                if (!_categoryAxis.equalSpacing)
                                {
                                    if (_dataProvider.length > _loc_3.start)
                                    {
                                        _loc_3.start = _dataProvider.getItemAt(_loc_3.start).time;
                                    }
                                    if (_dataProvider.length > _loc_3.end)
                                    {
                                        _loc_3.end = _dataProvider.getItemAt(_loc_3.end).time;
                                    }
                                }
                                if (!_skipZoomDispatch)
                                {
                                    dispatchEvent(_loc_3);
                                    callLater(hideCursor);
                                }
                            }
                        }
                        else
                        {
                            _loc_5 = this.mouseY;
                            _loc_6 = this.mouseX;
                            if (Math.abs(_loc_6 - _initialMouseX) < 3)
                            {
                            }
                            if (Math.abs(_loc_5 - _initialMouseY) < 3)
                            {
                            }
                            else
                            {
                                if (!_selectWithoutZooming)
                                {
                                    _loc_3 = new CursorEvent(CursorEvent.ZOOMED);
                                }
                                else
                                {
                                    _loc_3 = new CursorEvent(CursorEvent.SELECTED);
                                }
                                _loc_3.selectionHeight = _selection.height;
                                _loc_3.selectionWidth = _selection.width;
                                _loc_3.selectionY = _selection.y;
                                _loc_3.selectionX = _selection.x;
                                if (!_skipZoomDispatch)
                                {
                                    dispatchEvent(_loc_3);
                                }
                            }
                        }
                    }
                }
                _skipZoomDispatch = false;
                _zooming = false;
                _panning = false;
            }
            return;
        }// end function

        public function set categoryBalloonDateFormat(param1:String) : void
        {
            _categoryBalloonDateFormat = param1;
            invalidateDisplayList();
            return;
        }// end function

        protected function getBalloonColor(param1:AmGraph, param2:GraphDataItem) : Number
        {
            var _loc_6:Number = NaN;
            var _loc_7:Array = null;
            var _loc_3:* = param1.getStyle("lineColor");
            var _loc_4:* = param1.getStyle("balloonColor");
            var _loc_5:* = param1.getStyle("fillColors");
            if (_loc_5)
            {
                _loc_3 = _loc_5[0];
            }
            if (param2.isNegative)
            {
                _loc_6 = param1.getStyle("negativeLineColor");
                _loc_7 = param1.getStyle("negativeFillColors");
                if (_loc_7)
                {
                    _loc_6 = _loc_7[0];
                }
                if (!isNaN(_loc_6))
                {
                    _loc_3 = _loc_6;
                }
            }
            if (!isNaN(param2.color))
            {
                _loc_3 = param2.color;
            }
            if (!_loc_4)
            {
                _loc_4 = ColorUtil.adjustBrightness(_loc_3, -25);
            }
            return _loc_4;
        }// end function

        public function destroyValueBalloons() : void
        {
            var _loc_1:Number = NaN;
            if (_valueBalloons)
            {
                _loc_1 = 0;
                while (_loc_1 < _valueBalloons.length)
                {
                    
                    _valueBalloons[_loc_1].balloon.destroy();
                    delete _valueBalloons[_loc_1].balloon;
                    _loc_1 = _loc_1 + 1;
                }
            }
            return;
        }// end function

        override protected function createChildren() : void
        {
            super.createChildren();
            this.mouseChildren = false;
            this.mouseEnabled = false;
            _cursor = new Sprite();
            addChild(_cursor);
            _hitRect = new PlotArea();
            _hitRect.alpha = 0;
            addChild(_hitRect);
            _mask = new Rect(1, 1, [0], [0]);
            addChild(_mask);
            _categoryBalloon = new AmBalloon();
            _categoryBalloon.filters = [];
            addChild(_categoryBalloon);
            _valueAxisBalloon = new AmBalloon();
            _valueAxisBalloon.filters = [];
            addChild(_valueAxisBalloon);
            _valueBalloonsContainer = new UIComponent();
            addChild(_valueBalloonsContainer);
            _bulletsContainer = new UIComponent();
            addChild(_bulletsContainer);
            return;
        }// end function

        public function set dx(param1:Number) : void
        {
            _dx = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function set dy(param1:Number) : void
        {
            _dy = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function get zooming() : Boolean
        {
            return _zooming;
        }// end function

        protected function getMousePosition() : Number
        {
            var _loc_1:Number = NaN;
            if (_rotate)
            {
                _loc_1 = this.mouseY;
                if (_loc_1 < 0)
                {
                    _loc_1 = 0;
                }
                if (_loc_1 > this.height)
                {
                    _loc_1 = this.height;
                }
            }
            else
            {
                _loc_1 = this.mouseX;
                if (_loc_1 < 0)
                {
                    _loc_1 = 0;
                }
                if (_loc_1 > this.width)
                {
                    _loc_1 = this.width;
                }
            }
            return _loc_1;
        }// end function

        public function set pan(param1:Boolean) : void
        {
            _pan = param1;
            _zoomable = !param1;
            invalidateDisplayList();
            return;
        }// end function

        public function set cursorPosition(param1:String) : void
        {
            _cursorPosition = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function hideCursor(param1:Boolean = true) : void
        {
            if (_selectWithoutZooming)
            {
                if (_line)
                {
                    _line.visible = false;
                }
            }
            else
            {
                _cursor.visible = false;
            }
            if (_valueAxisBalloon)
            {
                _valueAxisBalloon.hide();
            }
            _categoryBalloon.hide();
            Utils.removeChildren(_valueBalloonsContainer);
            Utils.removeChildren(_bulletsContainer);
            _previousIndex = NaN;
            if (param1)
            {
                dispatchEvent(new CursorEvent(CursorEvent.ON_HIDE_CURSOR));
            }
            return;
        }// end function

        protected function balloonValueAxis() : ValueAxis
        {
            var _loc_1:ValueAxis = null;
            if (_showValueAxisValue)
            {
                _loc_1 = _chart.valueAxes[0];
            }
            if (_showValueOfAxis)
            {
                _loc_1 = _showValueOfAxis;
            }
            return _loc_1;
        }// end function

        public function get draw() : Boolean
        {
            return _draw;
        }// end function

        public function get categoryBalloon() : AmBalloon
        {
            return _categoryBalloon;
        }// end function

        public function set showValueOfAxis(param1:ValueAxis) : void
        {
            _showValueOfAxis = param1;
            return;
        }// end function

        protected function updateCrosshair() : void
        {
            _cursor.visible = true;
            if (_line)
            {
                _line.visible = true;
            }
            _line.x = this.mouseX;
            _line.y = this.mouseY;
            if (_zooming)
            {
                updateSelectionWidth(this.mouseX);
                updateSelectionHeight(this.mouseY);
            }
            return;
        }// end function

        public function set zoomable(param1:Boolean) : void
        {
            _zoomable = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function set categoryBalloonEnabled(param1:Boolean) : void
        {
            _categoryBalloonEnabled = param1;
            invalidateDisplayList();
            return;
        }// end function

        public function destroyListeners() : void
        {
            clearInterval(_interval);
            if (stage)
            {
                stage.removeEventListener(MouseEvent.MOUSE_UP, handleMouseUp);
                stage.removeEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
            }
            return;
        }// end function

        public function get selectWithoutZooming() : Boolean
        {
            return _selectWithoutZooming;
        }// end function

        public function set dataProvider(param1:ArrayCollection) : void
        {
            _dataProvider = param1;
            if (_dataProvider.length > 0)
            {
                _firstTime = SerialDataItem(_dataProvider.getItemAt(0)).time;
                _lastTime = SerialDataItem(_dataProvider.getItemAt((_dataProvider.length - 1))).time;
            }
            invalidateDisplayList();
            return;
        }// end function

        protected function createCursor() : void
        {
            var _loc_3:Array = null;
            var _loc_4:Array = null;
            var _loc_6:ValueAxis = null;
            var _loc_7:Number = NaN;
            var _loc_1:* = getStyle("cursorAlpha");
            var _loc_2:* = getStyle("selectionAlpha");
            _categoryBalloonPosition = _categoryAxis.position;
            _hitRect.setSize(this.width, this.height, _dx, _dy);
            _inside = _categoryAxis.inside;
            _axisThickness = _categoryAxis.getStyle("axisThickness");
            if (_rotate)
            {
                _loc_3 = [0, this.width, this.width + _dx];
                _loc_4 = [0, 0, _dy];
                _selection = new Rect(this.width, 1, [_cursorColor], [_loc_2]);
                if (_crosshair)
                {
                    _valueLine = new Line([0, 0], [0, this.height], _cursorColor, _loc_1, 0);
                    _cursor.addChild(_valueLine);
                }
            }
            else
            {
                _loc_3 = [_dx, 0, 0];
                _loc_4 = [_dy, 0, this.height];
                _selection = new Rect(1, this.height, [_cursorColor], [_loc_2]);
                if (_crosshair)
                {
                    _valueLine = new Line([0, (this.width + 1)], [0, 0], _cursorColor, _loc_1, 0);
                    _cursor.addChild(_valueLine);
                }
            }
            if (!_showValueOfAxis)
            {
            }
            if (_showValueAxisValue)
            {
                _loc_6 = balloonValueAxis();
                _valueAxisBalloon.setStyle("color", this.getStyle("valueAxisBalloonTextColor"));
                _valueAxisBalloon.setStyle("fillColor", this.getStyle("valueAxisBalloonColor"));
                _valueAxisBalloon.setStyle("fillAlpha", this.getStyle("valueAxisBalloonAlpha"));
                _valueAxisBalloon.setStyle("borderColor", this.getStyle("valueAxisBalloonColor"));
                _valueAxisBalloon.setStyle("pointerWidth", 0);
                if (_rotate)
                {
                    _valueAxisBalloon.setStyle("pointerOrientation", "vertical");
                }
                else
                {
                    _valueAxisBalloon.setStyle("pointerOrientation", "horizontal");
                    _loc_7 = _loc_6.getStyle("axisThickness");
                    if (_loc_6.position == "right")
                    {
                        _valueAxisBalloon.setBounds(this.width + 2 + _loc_7, 0, this.width + 1000, this.height);
                    }
                    else
                    {
                        _valueAxisBalloon.setBounds(-1000, 0, -_loc_7, this.height);
                    }
                }
                if (_loc_6.inside)
                {
                    _valueAxisBalloon.setBounds(0, 0, (this.width + 1), this.height);
                }
            }
            _selection.visible = false;
            _line = new Line(_loc_3, _loc_4, _cursorColor, _loc_1, 0);
            _cursor.addChild(_line);
            _cursor.addChild(_selection);
            var _loc_5:* = _categoryAxis.getStyle("tickLength");
            _categoryBalloon.setStyle("pointerWidth", _loc_5);
            if (_rotate)
            {
                if (_inside)
                {
                    _categoryBalloon.setStyle("pointerWidth", 0);
                }
                if (_categoryBalloonPosition == "right")
                {
                    if (_inside)
                    {
                        _categoryBalloon.setBounds(0, _dy, this.width + _dx, this.height + _dy);
                    }
                    else
                    {
                        _categoryBalloon.setBounds(this.width + _dx + _axisThickness, _dy, this.width + 1000, this.height + _dy);
                    }
                }
                else if (_inside)
                {
                    _categoryBalloon.setBounds(0, 0, this.width, this.height);
                }
                else
                {
                    _categoryBalloon.setBounds(-1000, -1000, -_loc_5 - _axisThickness, this.height + 15);
                }
            }
            else
            {
                _categoryBalloon.setStyle("maxWidth", this.width);
                if (_categoryAxis.parseDates)
                {
                    _loc_5 = 0;
                    _categoryBalloon.setStyle("pointerWidth", 0);
                }
                if (_categoryBalloonPosition == "top")
                {
                    if (_inside)
                    {
                        _categoryBalloon.setBounds(_dx, _dy, this.width + _dx, this.height);
                    }
                    else
                    {
                        _categoryBalloon.setBounds(_dx, -1000, this.width + _dx, _dy - _loc_5 - _axisThickness);
                    }
                }
                else if (_inside)
                {
                    _categoryBalloon.setBounds(0, 0, this.width, this.height - _loc_5);
                }
                else
                {
                    _categoryBalloon.setBounds(0, this.height + _loc_5 + _axisThickness, this.width, this.height + _loc_5 + _axisThickness);
                }
            }
            return;
        }// end function

        public function get categoryBalloonDateFormat() : String
        {
            return _categoryBalloonDateFormat;
        }// end function

        public function set categoryAxis(param1:CategoryAxis) : void
        {
            _categoryAxis = param1;
            return;
        }// end function

        public function updateCursor(param1:Number, param2:Boolean = true) : void
        {
            var _loc_3:SerialDataItem = null;
            var _loc_4:Number = NaN;
            var _loc_5:Number = NaN;
            var _loc_6:Number = NaN;
            var _loc_7:DateFormatter = null;
            var _loc_8:String = null;
            var _loc_9:AmGraph = null;
            var _loc_10:Number = NaN;
            var _loc_11:Number = NaN;
            var _loc_12:GraphDataItem = null;
            var _loc_13:AmBalloon = null;
            var _loc_14:Number = NaN;
            var _loc_15:AmGraph = null;
            var _loc_16:Number = NaN;
            var _loc_17:Number = NaN;
            var _loc_18:Number = NaN;
            var _loc_19:Number = NaN;
            var _loc_20:AmBalloon = null;
            var _loc_21:String = null;
            var _loc_22:NumberFormatter = null;
            var _loc_23:DateFormatter = null;
            var _loc_24:String = null;
            var _loc_25:CursorEvent = null;
            if (_drawing)
            {
                removeDrawingLine();
                _drawingLine = new Line([_drawStartX, this.mouseX], [_drawStartY, this.mouseY], _cursorColor, 1, 1);
                this.addChild(_drawingLine);
            }
            if (enabled)
            {
                if (_dataProvider.length > param1)
                {
                    _index = param1;
                    _loc_3 = _dataProvider[_index];
                    _loc_4 = _loc_3.x[_categoryAxis.id];
                    if (_panning)
                    {
                        if (_rotate)
                        {
                            _loc_5 = _panClickPos - this.mouseY;
                        }
                        else
                        {
                            _loc_5 = _panClickPos - this.mouseX;
                        }
                        _loc_6 = _loc_5 / _stepWidth;
                        if (_categoryAxis.parseDates)
                        {
                        }
                        if (_categoryAxis.equalSpacing)
                        {
                            _loc_6 = Math.round(_loc_6);
                        }
                        if (_loc_6 != 0)
                        {
                            if (_categoryAxis.parseDates)
                            {
                            }
                            if (!_categoryAxis.equalSpacing)
                            {
                                if (_panClickEndTime + _loc_6 > _lastTime)
                                {
                                    _loc_6 = _lastTime - _panClickEndTime;
                                }
                                if (_panClickStartTime + _loc_6 < _firstTime)
                                {
                                    _loc_6 = _firstTime - _panClickStartTime;
                                }
                                if (!_selectWithoutZooming)
                                {
                                    _loc_25 = new CursorEvent(CursorEvent.ZOOMED);
                                }
                                else
                                {
                                    _loc_25 = new CursorEvent(CursorEvent.SELECTED);
                                }
                                _loc_25.start = _panClickStartTime + _loc_6;
                                _loc_25.end = _panClickEndTime + _loc_6;
                                dispatchEvent(_loc_25);
                            }
                            else
                            {
                                if (_panClickEnd + _loc_6 < _dataProvider.length)
                                {
                                }
                                if (_panClickStart + _loc_6 < 0)
                                {
                                }
                                else
                                {
                                    if (!_selectWithoutZooming)
                                    {
                                        _loc_25 = new CursorEvent(CursorEvent.ZOOMED);
                                    }
                                    else
                                    {
                                        _loc_25 = new CursorEvent(CursorEvent.SELECTED);
                                    }
                                    _loc_25.start = _panClickStart + _loc_6;
                                    _loc_25.end = _panClickEnd + _loc_6;
                                    dispatchEvent(_loc_25);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (_cursorPosition == "start")
                        {
                            _loc_4 = _loc_4 - _categoryAxis.cellWidth / 2;
                        }
                        if (_cursorPosition == "mouse")
                        {
                            if (_rotate)
                            {
                                _loc_4 = this.mouseY;
                            }
                            else
                            {
                                _loc_4 = this.mouseX;
                            }
                        }
                        if (_loc_4 < 0)
                        {
                            if (_zooming)
                            {
                                _loc_4 = 0;
                            }
                            else
                            {
                                hideCursor();
                                return;
                            }
                        }
                        if (_rotate)
                        {
                            if (_loc_4 > (this.height + 1))
                            {
                                if (_zooming)
                                {
                                    _loc_4 = this.height;
                                }
                                else
                                {
                                    hideCursor();
                                    return;
                                }
                            }
                        }
                        else if (_loc_4 > this.width)
                        {
                            if (_zooming)
                            {
                                _loc_4 = this.width;
                            }
                            else
                            {
                                hideCursor();
                                return;
                            }
                        }
                        if (_line)
                        {
                            if (_rotate)
                            {
                                _line.y = _loc_4;
                            }
                            else
                            {
                                _line.x = _loc_4;
                            }
                        }
                        _cursor.visible = true;
                        if (_line)
                        {
                            _line.visible = true;
                        }
                        if (_valueLine)
                        {
                            _valueLine.visible = true;
                        }
                        if (_zooming)
                        {
                            if (_rotate)
                            {
                                updateSelectionHeight(_loc_4);
                            }
                            else
                            {
                                updateSelectionWidth(_loc_4);
                            }
                        }
                        if (_categoryBalloonEnabled)
                        {
                            _loc_3 = _dataProvider.getItemAt(_index) as SerialDataItem;
                            if (_categoryAxis.parseDates)
                            {
                                _loc_7 = new DateFormatter();
                                _loc_7.formatString = _categoryBalloonDateFormat;
                                _loc_8 = _loc_7.format(_loc_3.category);
                                if (_loc_8.indexOf("fff") != -1)
                                {
                                    _loc_8 = formatMilliseconds(_loc_8, _loc_3.category as Date);
                                }
                                _categoryBalloon.show(_loc_8);
                            }
                            else
                            {
                                _categoryBalloon.show(String(_loc_3.category));
                            }
                            if (_rotate)
                            {
                                if (_inside)
                                {
                                    if (_categoryBalloonPosition == "right")
                                    {
                                        _categoryBalloon.setBounds(0, _dy, this.width + _dx, _loc_4 + _dy);
                                    }
                                    else
                                    {
                                        _categoryBalloon.setBounds(0, _dy, this.width + _dx, _loc_4);
                                    }
                                }
                                if (_categoryBalloonPosition == "right")
                                {
                                    if (_inside)
                                    {
                                        _categoryBalloon.setPosition(this.width + _dx, _loc_4 + _dy);
                                    }
                                    else
                                    {
                                        _categoryBalloon.setPosition(this.width + _dx + _axisThickness, _loc_4 + _dy);
                                    }
                                }
                                else if (_inside)
                                {
                                    _categoryBalloon.setPosition(0, _loc_4);
                                }
                                else
                                {
                                    _categoryBalloon.setPosition(-_axisThickness, _loc_4);
                                }
                            }
                            else if (_categoryBalloonPosition == "top")
                            {
                                if (_inside)
                                {
                                    _categoryBalloon.setPosition(_loc_4 + _dx, _dy);
                                }
                                else
                                {
                                    _categoryBalloon.setPosition(_loc_4 + _dx, _dy - _axisThickness);
                                }
                            }
                            else if (_inside)
                            {
                                _categoryBalloon.setPosition(_loc_4, this.height);
                            }
                            else
                            {
                                _categoryBalloon.setPosition(_loc_4, this.height + _axisThickness);
                            }
                        }
                        else
                        {
                            _categoryBalloon.visible = false;
                        }
                        if (_graphs)
                        {
                        }
                        if (_bulletsEnabled)
                        {
                            showBullets();
                        }
                        if (_graphs)
                        {
                        }
                        if (_valueBalloonsEnabled)
                        {
                            destroyValueBalloons();
                            Utils.removeChildren(_valueBalloonsContainer);
                            _valueBalloons = new Array();
                            if (_oneBalloonOnly)
                            {
                                _loc_14 = Infinity;
                                _loc_10 = 0;
                                while (_loc_10 < _graphs.length)
                                {
                                    
                                    _loc_9 = _graphs[_loc_10];
                                    if (_loc_9.showBalloon)
                                    {
                                    }
                                    if (!_loc_9.hidden)
                                    {
                                    }
                                    if (_loc_9.balloonText)
                                    {
                                        _loc_3 = _dataProvider.getItemAt(_index) as SerialDataItem;
                                        _loc_12 = _loc_3.charts[_loc_9.chart.id].axes[_loc_9.valueAxis.id].graphs[_loc_9.id];
                                        _loc_11 = _loc_12.y;
                                        if (!isNaN(_loc_11))
                                        {
                                            if (_rotate)
                                            {
                                                if (Math.abs(this.mouseX - _loc_11) < _loc_14)
                                                {
                                                    _loc_14 = Math.abs(this.mouseX - _loc_11);
                                                    _loc_15 = _loc_9;
                                                }
                                            }
                                            else if (Math.abs(this.mouseY - _loc_11) < _loc_14)
                                            {
                                                _loc_14 = Math.abs(this.mouseY - _loc_11);
                                                _loc_15 = _loc_9;
                                            }
                                        }
                                    }
                                    _loc_10 = _loc_10 + 1;
                                }
                            }
                            _loc_13 = _chart.balloon;
                            _loc_10 = 0;
                            while (_loc_10 < _graphs.length)
                            {
                                
                                _loc_9 = _graphs[_loc_10];
                                if (_oneBalloonOnly)
                                {
                                }
                                if (_loc_9 != _loc_15)
                                {
                                }
                                else
                                {
                                    if (_loc_9.showBalloon)
                                    {
                                    }
                                    if (!_loc_9.hidden)
                                    {
                                    }
                                    if (_loc_9.balloonText)
                                    {
                                        _loc_3 = _dataProvider.getItemAt(_index) as SerialDataItem;
                                        _loc_12 = _loc_3.charts[_loc_9.chart.id].axes[_loc_9.valueAxis.id].graphs[_loc_9.id];
                                        _loc_11 = _loc_12.y;
                                        if (!isNaN(_loc_11))
                                        {
                                            _loc_16 = _loc_12.x;
                                            if (_rotate)
                                            {
                                                _loc_17 = _loc_11;
                                                _loc_18 = _loc_16;
                                            }
                                            else
                                            {
                                                _loc_17 = _loc_16;
                                                _loc_18 = _loc_11;
                                            }
                                            _loc_19 = getBalloonColor(_loc_9, _loc_12);
                                            _loc_20 = new AmBalloon();
                                            _loc_20.styleName = _loc_13;
                                            _loc_20.filters = _loc_13.filters;
                                            _loc_20.setBounds(0, 0, this.width, this.height);
                                            _loc_20.setStyle("pointerOrientation", "horizontal");
                                            _loc_20.changeColor(_loc_19);
                                            _valueBalloonsContainer.addChild(_loc_20);
                                            _loc_20.setPosition(_loc_17, _loc_18);
                                            _loc_21 = _loc_9.balloonText;
                                            if (_categoryAxis.parseDates)
                                            {
                                                if (_loc_21.indexOf("[[category]]") != -1)
                                                {
                                                    _loc_23 = new DateFormatter();
                                                    _loc_23.formatString = _categoryBalloonDateFormat;
                                                    _loc_24 = _loc_23.format(_loc_3.category);
                                                    if (_loc_24.indexOf("fff") != -1)
                                                    {
                                                        _loc_24 = formatMilliseconds(_loc_8, _loc_3.category as Date);
                                                    }
                                                    _loc_21 = _loc_21.split("[[category]]").join(_loc_24);
                                                }
                                            }
                                            _loc_22 = _loc_9.numberFormatter;
                                            if (!_loc_22)
                                            {
                                                _loc_22 = _chart.numberFormatter;
                                            }
                                            _loc_21 = Utils.formatString(_loc_21, _loc_12.values, _loc_22, _chart.percentFormatter);
                                            _loc_21 = Utils.formatString(_loc_21, _loc_12, _loc_22, _chart.percentFormatter);
                                            if (_loc_21 != "")
                                            {
                                                _loc_20.show(_loc_21);
                                            }
                                            _loc_20.validateDisplayList();
                                            _valueBalloons.push({yy:_loc_11, balloon:_loc_20});
                                        }
                                    }
                                }
                                _loc_10 = _loc_10 + 1;
                            }
                            if (!_rotate)
                            {
                                arrangeBalloons();
                            }
                        }
                        if (param2)
                        {
                            _loc_25 = new CursorEvent(CursorEvent.CHANGED, true);
                            _loc_25.index = _index;
                            _loc_25.data = _dataProvider.getItemAt(_index);
                            _loc_25.zooming = _zooming;
                            if (_rotate)
                            {
                                _loc_25.position = this.mouseY;
                            }
                            else
                            {
                                _loc_25.position = this.mouseX;
                            }
                            dispatchEvent(_loc_25);
                            _skipZoomDispatch = false;
                        }
                        else
                        {
                            _skipZoomDispatch = true;
                        }
                        _previousIndex = _index;
                    }
                }
            }
            else
            {
                hideCursor();
            }
            return;
        }// end function

        protected function onRemoved(event:Event) : void
        {
            destroyListeners();
            return;
        }// end function

        public function set valueBalloonsEnabled(param1:Boolean) : void
        {
            _valueBalloonsEnabled = param1;
            invalidateDisplayList();
            return;
        }// end function

        protected function handleMouseDown(event:MouseEvent = null) : void
        {
            if (!_zoomable)
            {
            }
            if (!_pan)
            {
            }
            if (_draw)
            {
                if (this.mouseX > 0)
                {
                }
                if (this.mouseX < this.width)
                {
                }
                if (this.mouseY > 0)
                {
                }
                if (this.mouseY < this.height)
                {
                }
                if (!_chart.rolledOver)
                {
                }
                if (!event)
                {
                    if (_draw)
                    {
                        _drawStartY = this.mouseY;
                        _drawStartX = this.mouseX;
                        _drawing = true;
                    }
                    else if (_pan)
                    {
                        removeCursors();
                        this.cursorManager.setCursor(_grabAndDrag);
                        _cursorsChanged = true;
                        _panning = true;
                        hideCursor(true);
                        if (_rotate)
                        {
                            _panClickPos = this.mouseY;
                        }
                        else
                        {
                            _panClickPos = this.mouseX;
                        }
                        _panClickStart = _start;
                        _panClickEnd = _end;
                        _panClickStartTime = _startTime;
                        _panClickEndTime = _endTime;
                    }
                    if (_zoomable)
                    {
                        if (_type == "cursor")
                        {
                            _fromIndex = _index;
                            if (_rotate)
                            {
                                _initialMouse = this.mouseY;
                                _selection.y = _line.y;
                                _selectionPosY = _line.y;
                                _selection.height = 0;
                            }
                            else
                            {
                                _initialMouse = this.mouseX;
                                _selection.x = _line.x;
                                _selectionPosX = _line.x;
                                _selection.width = 0;
                            }
                        }
                        else
                        {
                            _initialMouseY = this.mouseY;
                            _initialMouseX = this.mouseX;
                            _selection.x = _line.x;
                            _selection.y = _line.y;
                            _selection.width = 0;
                            _selection.height = 0;
                            _selectionPosX = _line.x;
                            _selectionPosY = _line.y;
                        }
                        _selection.visible = true;
                        _zooming = true;
                    }
                }
            }
            return;
        }// end function

        public function get showValueOfAxis() : ValueAxis
        {
            return _showValueOfAxis;
        }// end function

        public function setPosition(param1:Number = NaN, param2:Boolean = true) : void
        {
            var _loc_3:Number = NaN;
            if (_type == "cursor")
            {
                if (_dataProvider.length > 0)
                {
                    if (!param1)
                    {
                        param1 = getMousePosition();
                    }
                    if (param1 == _previousMousePosition)
                    {
                    }
                    if (_oneBalloonOnly)
                    {
                        _loc_3 = _categoryAxis.xToIndex(param1);
                        if (_loc_3 == _previousIndex)
                        {
                        }
                        if (!_zoomed)
                        {
                        }
                        if (_cursorPosition != "mouse")
                        {
                        }
                        if (_oneBalloonOnly)
                        {
                            updateCursor(_loc_3, param2);
                            _zoomed = false;
                        }
                    }
                    _previousMousePosition = param1;
                    if (_valueLine)
                    {
                        updateValueLine();
                    }
                    if (this.mouseX == _previousMouseX)
                    {
                    }
                    if (this.mouseY != _previousMouseY)
                    {
                        if (param2)
                        {
                            if (_valueAxisBalloon)
                            {
                                updateValueAxisBalloon();
                            }
                        }
                        _previousMouseX = this.mouseX;
                        _previousMouseY = this.mouseY;
                    }
                }
            }
            else
            {
                updateCrosshair();
            }
            return;
        }// end function

        public function get zoomable() : Boolean
        {
            return _zoomable;
        }// end function

        protected function formatMilliseconds(param1:String, param2:Date) : String
        {
            var _loc_3:Number = NaN;
            var _loc_4:String = null;
            if (param1.indexOf("fff") != -1)
            {
                _loc_3 = (param2 as Date).getMilliseconds();
                _loc_4 = String(_loc_3);
                if (_loc_3 < 10)
                {
                    _loc_4 = "00" + _loc_3;
                }
                if (_loc_3 >= 10)
                {
                }
                if (_loc_3 < 100)
                {
                    _loc_4 = "0" + _loc_3;
                }
                param1 = Utils.replace(param1, "fff", _loc_4);
            }
            return param1;
        }// end function

        public function set chart(param1:AmRectangularChart) : void
        {
            _chart = param1;
            return;
        }// end function

        protected function updateSelectionHeight(param1:Number) : void
        {
            if (_selectionPosY > param1)
            {
                _selection.y = param1;
                _selection.height = _selectionPosY - param1;
            }
            if (_selectionPosY < param1)
            {
                _selection.y = _selectionPosY;
                _selection.height = param1 - _selectionPosY;
            }
            if (_selectionPosY == param1)
            {
                _selection.y = param1;
                _selection.height = 0;
            }
            return;
        }// end function

        public function set graphs(param1:Array) : void
        {
            _graphs = param1;
            return;
        }// end function

        public function zoom(param1:Number, param2:Number, param3:Number = NaN, param4:Number = NaN) : void
        {
            var _loc_5:Number = NaN;
            if (_selection)
            {
                _selection.visible = false;
            }
            if (_valueAxisBalloon)
            {
                _valueAxisBalloon.hide();
            }
            _start = param1;
            _end = param2;
            _startTime = param3;
            _endTime = param4;
            _zoomed = true;
            if (_categoryAxis.parseDates)
            {
            }
            if (!_categoryAxis.equalSpacing)
            {
                _loc_5 = _endTime - _startTime + _categoryAxis.minDuration;
                if (_rotate)
                {
                    _stepWidth = this.height / _loc_5;
                }
                else
                {
                    _stepWidth = this.width / _loc_5;
                }
            }
            else if (_rotate)
            {
                _stepWidth = this.height / (_end - _start);
            }
            else
            {
                _stepWidth = this.width / (_end - _start);
            }
            _previousIndex = undefined;
            _previousMousePosition = undefined;
            return;
        }// end function

        protected function showBullets() : void
        {
            var _loc_2:AmGraph = null;
            var _loc_3:SerialDataItem = null;
            var _loc_4:GraphDataItem = null;
            var _loc_5:Number = NaN;
            var _loc_6:Number = NaN;
            var _loc_7:Number = NaN;
            var _loc_8:Number = NaN;
            var _loc_9:Sprite = null;
            Utils.removeChildren(_bulletsContainer);
            var _loc_1:Number = 0;
            while (_loc_1 < _graphs.length)
            {
                
                _loc_2 = _graphs[_loc_1];
                if (_loc_2.showBalloon)
                {
                }
                if (!_loc_2.hidden)
                {
                }
                if (_loc_2.balloonText)
                {
                    _loc_3 = _dataProvider.getItemAt(_index) as SerialDataItem;
                    _loc_4 = _loc_3.charts[_loc_2.chart.id].axes[_loc_2.valueAxis.id].graphs[_loc_2.id];
                    _loc_5 = _loc_4.y;
                    if (!isNaN(_loc_5))
                    {
                        _loc_6 = _loc_4.x;
                        if (_rotate)
                        {
                            _loc_7 = _loc_5;
                            _loc_8 = _loc_6;
                        }
                        else
                        {
                            _loc_7 = _loc_6;
                            _loc_8 = _loc_5;
                        }
                        _loc_9 = new Sprite();
                        _loc_9.graphics.beginFill(getBalloonColor(_loc_2, _loc_4), _loc_2.getStyle("cursorBulletAlpha"));
                        _loc_9.graphics.drawCircle(0, 0, _bulletSize / 2);
                        _loc_9.x = _loc_7;
                        _loc_9.y = _loc_8;
                        _bulletsContainer.addChild(_loc_9);
                    }
                }
                _loc_1 = _loc_1 + 1;
            }
            return;
        }// end function

        override protected function updateDisplayList(param1:Number, param2:Number) : void
        {
            super.updateDisplayList(param1, param2);
            destroy();
            _cursorColor = this.getStyle("cursorColor");
            var _loc_3:* = this.getStyle("categoryBalloonColor");
            var _loc_4:* = this.getStyle("categoryBalloonAlpha");
            if (isNaN(_loc_3))
            {
                _loc_3 = _cursorColor;
            }
            _categoryBalloon.setStyle("fillColor", _loc_3);
            _categoryBalloon.setStyle("fillAlpha", _loc_4);
            _categoryBalloon.setStyle("borderColor", _loc_3);
            _categoryBalloon.setStyle("color", this.getStyle("color"));
            if (_rotate)
            {
                _categoryBalloon.setStyle("pointerOrientation", "horizontal");
            }
            if (_dataProvider.length > 0)
            {
                if (_type == "cursor")
                {
                    createCursor();
                }
                else
                {
                    createCrosshair();
                }
            }
            return;
        }// end function

        public function destroy() : void
        {
            if (_categoryBalloon)
            {
                _categoryBalloon.destroy();
            }
            Utils.removeChildren(_cursor);
            return;
        }// end function

        protected function arrangeBalloons() : void
        {
            var _loc_4:AmBalloon = null;
            _valueBalloons.sortOn("yy", Array.NUMERIC | Array.DESCENDING);
            var _loc_1:* = _valueBalloons.length;
            var _loc_2:* = this.height;
            var _loc_3:Number = 0;
            while (_loc_3 < _loc_1)
            {
                
                _loc_4 = _valueBalloons[_loc_3].balloon;
                _loc_4.setBounds(0, 0, this.width, _loc_2);
                _loc_4.validateDisplayList();
                _loc_2 = _loc_4.yPos - 3;
                _loc_3 = _loc_3 + 1;
            }
            arrangeBalloons2();
            return;
        }// end function

        private static function initStyles() : Boolean
        {
            var styleDeclaration:* = StyleManager.getStyleDeclaration("ChartCursor");
            if (!styleDeclaration)
            {
                styleDeclaration = new CSSStyleDeclaration();
            }
            styleDeclaration.defaultFactory = function () : void
            {
                this.cursorAlpha = 1;
                this.selectionAlpha = 0.2;
                this.cursorColor = 13369344;
                this.categoryBalloonAlpha = 1;
                this.categoryBalloonColor = undefined;
                this.valueAxisBalloonAlpha = 1;
                this.valueAxisBalloonColor = undefined;
                this.valueAxisBalloonTextColor = 16777215;
                this.color = 16777215;
                return;
            }// end function
            ;
            StyleManager.setStyleDeclaration("ChartCursor", styleDeclaration, false);
            return true;
        }// end function

    }
}
